package com.fz.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.fz.core.BaseEntity;
import java.io.Serializable;
import java.time.LocalDateTime;
import java.util.List;

import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.AllArgsConstructor;

/**
 * <p>
 * 存储系统权限信息
 * </p>
 *
 * @author hyr
 * @since 2025-06-18
 */
@Data
@AllArgsConstructor
@NoArgsConstructor
public class Permission extends BaseEntity {

    private static final long serialVersionUID = 1L;

    /**
     * 权限名称
     */
    private String name;

    /**
     * 权限描述
     */
    private String description;

    /**
     * 菜单路径
     */
    private String path;

    /**
     * 权限等级
     */
    private Integer level;

    /**
     * 权限类别
     */
    private Integer type;

    /**
     * 父权限ID（0=无父类）
     */
    private Long parentId;

    /**
     * 创建时间
     */
    private LocalDateTime createTime;

    /**
     * 修改时间
     */
    private LocalDateTime updateTime;

    @TableField(exist=false)
    private List<Permission> children;

    public Permission(String name, String description, String path, Integer level, Long parentId, Integer type) {
        this.name = name;
        this.description = description;
        this.path = path;
        this.level = level;
        this.parentId = parentId;
        this.type = type;
    }


    public Permission(long id, String name, String description, String path, Integer level,Long parentId, Integer type) {
        super(id);
        this.name = name;
        this.description = description;
        this.path = path;
        this.level = level;
        this.parentId = parentId;
        this.type = type;
    }
}
